import React, { Component } from 'react';
import { connect } from 'dva';
import { Icon, Card } from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from './Time.less';

const breadcrumbList = [{
  title: '一级菜单',
  href: '/',
}, {
  title: '二级菜单',
  href: '/',
}, {
  title: '三级菜单',
}];

const tabList = [
  {
    key: 'doc',
    tab: '当前时间',
  },
  {
    key: 'app',
    tab: '获取时间',
    default: true,
  },
];


@connect(state => ({
  time: state.time,
}))
export default class Time extends Component {
  // const sendTime=this.props.obj.send_time;

  getNowFormatDate() {
    const date = new Date();
    const yy = '年 ';
    const mm = '月 ';
    const dd = '日 ';
    const setperator2 = ':';
    let month = date.getMonth() + 1;
    let strDate = date.getDate();
    if (month >= 1 && month <= 9) {
      month = `0${month}`;
    }
    if (strDate >= 0 && strDate <= 9) {
      strDate = `0${strDate}`;
    }
    const currentdate = `${`${date.getFullYear() + yy + month + mm + strDate + dd} `}${date.getHours()}${setperator2}${date.getMinutes()}${setperator2}${date.getSeconds()}`;
    return currentdate;
  }

  render() {
    return (
      <div>
        <PageHeaderLayout
          style={{ marginBottom: 24 }}
          title="时间"
          tabList={tabList}
          logo={<Icon type="right-circle-o" style={{ fontSize: 26 }} />}
          breadcrumbList={breadcrumbList}
        >
          <Card title=" 当前系统时间：" style={{ marginBottom: 24 }} bordered={false}>
            <div className={styles.noData}>
              <Icon type="clock-circle-o" />{this.getNowFormatDate()}
            </div>
          </Card>
          <Card title=" 距离获取书包柜还有：" style={{ marginBottom: 24 }}>
            <div className={styles.noData}>
              <Icon type="clock-circle" />100天 23小时 45分 22秒
            </div>
          </Card>
        </PageHeaderLayout>
      </div>
    );
  }
}
